home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / sgwnd10 / enumtopm.vbs < prev    next >
Encoding:
Text File  |  1998-08-07  |  2.5 KB  |  75 lines

  1. '--------------------------------------------------------------------------
  2. ' EnumTopMost.vbs - Enumerates all visible top most windows and prints 
  3. '                   window list to the standard output (when using CSCRIPT)
  4. '
  5. ' This file is part of the sgWindow.
  6. ' Copyright (C) 1998 Stinga
  7. ' All rights reserved.
  8. '
  9. ' This sample demonstrates usage of the sgWindow component
  10. ' and it's window enumeration capabilities.
  11. '--------------------------------------------------------------------------
  12. option explicit
  13.  
  14.  
  15. const ws_OVERLAPPED           = &H00000000
  16. const ws_POPUP                = &H80000000
  17. const ws_CHILD                = &H40000000
  18. const ws_MINIMIZE             = &H20000000
  19. const ws_VISIBLE              = &H10000000
  20. const ws_DISABLED             = &H08000000
  21. const ws_CLIPSIBLINGS         = &H04000000
  22. const ws_CLIPCHILDREN         = &H02000000
  23. const ws_MAXIMIZE             = &H01000000
  24. const ws_CAPTION              = &H00C00000
  25. const ws_BORDER               = &H00800000
  26. const ws_DLGFRAME             = &H00400000
  27. const ws_VSCROLL              = &H00200000
  28. const ws_HSCROLL              = &H00100000
  29. const ws_SYSMENU              = &H00080000
  30. const ws_THICKFRAME           = &H00040000
  31. const ws_GROUP                = &H00020000
  32. const ws_TABSTOP              = &H00010000
  33. const ws_MINIMIZEBOX          = &H00020000
  34. const ws_MAXIMIZEBOX          = &H00010000
  35. const ws_TILED                = &H00000000
  36. const ws_ICONIC               = &H20000000
  37. const ws_SIZEBOX              = &H00040000
  38. const ws_OVERLAPPEDWINDOW     = &H00CF0000
  39. const ws_POPUPWINDOW          = &H80880000
  40. const ws_CHILDWINDOW          = &H40000000
  41. const ws_TILEDWINDOW          = &H00CF0000
  42.  
  43. dim vbCrLf
  44. vbCrLf = Chr(13) + Chr(10)
  45.  
  46. ' --- Collect window list
  47. Dim sList
  48. sList = GetTopMostList()
  49.  
  50. WScript.Echo sList
  51. WScript.Echo "This list was generated with Stinga sgWindow component." + vbCrLf + "Copyright (C) 1998 Stinga"
  52.  
  53. WScript.Quit
  54.  
  55. Private Function GetTopMostList()
  56.     
  57.     ' --- Create window object
  58.     dim g, wnd, wndChild
  59.     Set g = CreateObject("SGWindow.Globals")
  60.     Set wnd = g.DesktopWindow
  61.  
  62.     Dim style
  63.     style = ws_OVERLAPPEDWINDOW Or ws_VISIBLE
  64.     For Each wndChild In wnd.Children
  65.         if (wndChild.Style And style) = style then
  66.             GetTopMostList = GetTopMostList + wndChild.Class + " - '" _
  67.                              + wndChild.Text _
  68.                              + vbCrLf
  69.                              '+ "' (" + Hex(wndChild.HWND) _
  70.                              '+ " - " + Hex(wndChild.Style) + ")" _
  71.         end if
  72.     Next
  73. End Function
  74.  
  75.